using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Outpatient.Doman.Smart
{
    /// <summary>
    /// 优惠活动实体类
    /// </summary>
    [Table("Discount")]
    public class Discount
    {
        /// <summary>
        /// 优惠唯一标识 - 主键，自增
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int DiscountId { get; set; }

        /// <summary>
        /// 优惠名称
        /// </summary>
        [Required]
        [StringLength(100)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 描述
        /// </summary>
        [Column(TypeName = "text")]
        public string? Description { get; set; }

        /// <summary>
        /// 优惠规则(如"满100减20")
        /// </summary>
        [Required]
        [Column(TypeName = "text")]
        public string Rule { get; set; } = string.Empty;

        /// <summary>
        /// 关联的价目ID  外键
        /// </summary>
        [Required]
        public int PriceId { get; set; }

        /// <summary>
        /// 生效日期
        /// </summary>
        public DateTime ValidFrom { get; set; } = DateTime.Now;

        /// <summary>
        /// 失效日期
        /// </summary>
        public DateTime? ValidTo { get; set; }

        /// <summary>
        /// 是否删除 - 软删除
        /// </summary>
        public bool IsDeleted { get; set; } = false;

        /// <summary>
        /// 导航属性 - 关联的价目项
        /// </summary>
        [ForeignKey("PriceId")]
        public virtual PriceItem? PriceItem { get; set; }
    }
} 